// run: $exec < input
#include <iostream>
#include <string>

std::string a[3];
int count[3][30];

int main()
{
	for (int i = 0; i < 3; i++) {
		std::cin >> a[i];
		for (int j = 0; j < (int)a[i].size(); j++)
			count[i][a[i][j] - 'a']++;
//		for (auto ch : a[i]) count[i][ch - 'a']++;
	}

	int max = 0, ansb = 0;
	for (int tb = 0; ; tb++) {
		int tmp[30];
		bool ok = true;
		for (int i = 0; i < 26; i++) {
			tmp[i] = count[0][i] - tb * count[1][i];
			if (tmp[i] < 0) { ok = false; break; }
		}
		if (!ok) break;
		int min = 1 << 30;
		for (int i = 0; i < 26; i++) {
			if (!count[2][i]) continue;
			min = std::min(min, tmp[i] / count[2][i]);
		}
		if (tb + min > max) {
			max = tb + min;
			ansb = tb;
		}
	}
	std::string ans;
	for (int i = 0; i < ansb; i++) ans += a[1];
	for (int i = 0; i < max - ansb; i++) ans += a[2];
	for (int i = 0; i < 26; i++)
		count[0][i] -= ansb * count[1][i] + (max - ansb) * count[2][i];
	for (int i = 0; i < 26; i++)
		ans += std::string(count[0][i], 'a' + i);
	std::cout << ans << "\n";
}

